﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;
using WebStudio.Framework.Helper;

namespace WebStudio.Framework.Core
{
    /// <summary>
    /// 应用程序配置类 能够提供访问 Web.config 或 App.config 配置文件的应用程序配置类 
    /// 提供静态方法和属性，无需实例化此对象
    /// </summary>
    public class ApplicationConfiguration
    {
        /// <summary>
        /// 系统名称
        /// </summary>
        public static string SystemName
        {
            get
            {
                object obj = WebConfigurationManager.AppSettings["SystemName"];
                if (obj == null)
                {
                    return "WebStudio";
                }
                return ConvertHelper.StringParse(obj);
            }
        }

        /// <summary>
        /// 系统代码属性 
        /// </summary>
        public static string SystemCode
        {
            get
            {
                object obj = WebConfigurationManager.AppSettings["SystemCode"];
                if (obj == null)
                {
                    return "WebStudio";
                }
                return ConvertHelper.StringParse(obj);
            }
        }
 
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        public static string ConnectionString
        {
            get
            {
                return WebConfigurationManager.ConnectionStrings["Default"].ConnectionString.Replace("#DNS#", SysVariable.URLHost);
            }
        }

        /// <summary>
        /// 是否启用默认路径属性
        /// </summary>
        public static bool EnableDefaultPath
        {
            get
            {
                object obj = WebConfigurationManager.AppSettings["EnableDefaultPath"];
                if (obj == null)
                {
                    return false;
                }
                return ConvertHelper.BoolParse(obj);
            }
        }

        /// <summary>
        /// 主题代码属性 
        /// </summary>
        public static string ThemeCode
        {
            get
            {
                object obj = WebConfigurationManager.AppSettings["ThemeCode"];
                if (obj == null)
                {
                    return "Default";
                }
                return ConvertHelper.StringParse(obj);
            }
        }
 

 


 

    }
}
